﻿using SharpTestsEx;
using ar.com.juanpabloibanez.MVC.PagerHelper.Models;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace ar.com.juanpabloibanez.PagerHelper.Tests
{
    /// <summary>
    ///This is a test class for PagerViewModelTest and is intended
    ///to contain all PagerViewModelTest Unit Tests
    ///</summary>
    [TestClass]
    public class PagerViewModelTest
    {
        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext { get; set; }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        [TestMethod]
        public void SkipTest01()
        {
            PagerViewModel target = new PagerViewModel();
            target.CurrentPage = 10;
            target.PagerHelperOptions.PageSize = 10;
            target.TotalItems = 95;
            target.Skip.Should().Be.EqualTo(90);
        }

        [TestMethod]
        public void SkipTest02()
        {
            PagerViewModel target = new PagerViewModel();
            target.CurrentPage = 1;
            target.PagerHelperOptions.PageSize = 10;
            target.TotalItems = 5;
            target.Skip.Should().Be.EqualTo(0);
        }

        [TestMethod]
        public void SkipTest03()
        {
            PagerViewModel target = new PagerViewModel();
            target.CurrentPage = 10;
            target.PagerHelperOptions.PageSize = 10;
            target.TotalItems = 90;
            target.Skip.Should().Be.EqualTo(80);
        }

        [TestMethod]
        public void SkipTest04()
        {
            PagerViewModel target = new PagerViewModel();
            target.CurrentPage = 1;
            target.PagerHelperOptions.PageSize = 10;
            target.TotalItems = 0;
            target.Skip.Should().Be.EqualTo(0);
        }

        [TestMethod]
        public void TakeTest01()
        {
            PagerViewModel target = new PagerViewModel();
            target.PagerHelperOptions.PageSize = 5;
            target.Take.Should().Be.EqualTo(5);
        }

        [TestMethod]
        public void CurrentPageByButtonTest01()
        {
            PagerViewModel target = new PagerViewModel();
            target.CurrentPageByButton = 5;
            target.CurrentPage.Should().Be.EqualTo(5);
        }
    }
}
